package cn.zhl.algorithm._1_排序;

import java.util.Arrays;
import java.util.Random;
import java.util.stream.IntStream;

/**
 * @program: demos
 * @description:
 * @author: 刘振华
 * @create: 2020-05-27 12:53
 **/
public class SortTest {
	public static void main(String[] args) {
		int length = 10;
		Integer[] ints = new Integer[length];
		int[] is = new Random().ints(length, 1, 100).toArray();
		for(int i = 0;i<length;i++){
			System.out.println(is[i]);
			ints[i] = is[i];
		}
		testSort(ints,new Sort[]{
//			new SelectionSort(),
//			new BubbleSort(),
//			new GuibingSort(),
			new QuickSort()
		});
	}
	static void testSort(Integer[] array,Sort... sorts){
		Arrays.asList(sorts).forEach(sort->{
			Integer[] tmps = Arrays.copyOf(array, array.length);
			sort.sort(tmps);
			System.out.println(sort);
			for(int tmp:tmps){
				System.out.println(tmp);
			}
		});
	}
}
